/**
 * 图片显示控件
 */
var picker;
var imageUrl;
(function ($) {
    $.fn.extend({
        imagepicker: function (options) {
            var settings = $.extend({
                title: null,
                width: 0,
                height: 0,
                modal: false,
            }, options);
            return this.each(function () {
                picker = $(this);
                $(this).append("<img id='img' class='lazy' data-original='' width='" + settings.width + "' height=‘" + settings.height + "'>");
                var w = settings.width + 20;
                var h = settings.height + 20;
                $(this).dialog({
                    title: settings.title,
                    width: w,
                    height: h,
                    modal: settings.modal,
                    autoOpen: false,
                    resizable: false,
                });
            });
        }
    });
})(jQuery);

function openImagepicker(url) {
    picker.find("img").attr("data-original", url);
    picker.dialog("open");
    $("img.lazy").lazyload();
}